//
//  B_JixieCell.m
//  Estate
//
//  Created by heyong on 16/6/8.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "B_JixieCell.h"

@implementation B_JixieCell
- (void)setIsEdit:(BOOL )isEdit{
    if(isEdit){
        self.title.userInteractionEnabled=YES;
        self.num.userInteractionEnabled=YES;
    }else{
        self.title.userInteractionEnabled=NO;
        self.num.userInteractionEnabled=NO;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle=UITableViewCellSelectionStyleNone;
    self.title.textColor=UIColorFromRGB(0x797979);
    self.title.delegate=self;
    self.num.textColor=UIColorFromRGB(0x797979);
    self.num.delegate=self;
    self.kuohL.textColor=UIColorFromRGB(0x797979);
    self.kuohR.textColor=UIColorFromRGB(0x797979);
    self.kuohL.textColor=UIColorFromRGB(0x797979);
    self.tai.textColor=self.kuohL.textColor=UIColorFromRGB(0x797979);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configWithPlaceholder:(NSString *)phStr1 andValue:(NSString *)valueStr1 andNumPh:(NSString *)phStr2 andNumValue:(NSString *)valueStr2 andLabel:(NSString*)label andKeyType:(UIKeyboardType) kt{
    self.title.placeholder=phStr1;
    self.title.text=valueStr1;
    self.tai.text=label;
    self.num.placeholder=phStr2;
    self.num.text=valueStr2;
    self.num.keyboardType=kt;
}

- (IBAction)titleChanged:(UITextField *)sender {
    
    if(self.titleValueChangedBlock){
        self.titleValueChangedBlock(sender.text);
    }
    
}

- (IBAction)numChanged:(UITextField *)sender {
    
    if(self.numberValueChangedBlock){
        self.numberValueChangedBlock(sender.text);
    }
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    //   限制苹果系统输入法  禁止输入表情
    if ([[[UITextInputMode currentInputMode]primaryLanguage] isEqualToString:@"emoji"]) {
        return NO;
    }
 
    return YES;

}
//设置分割线
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect);
    //    //上分割线，
    //    CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor); CGContextStrokeRect(context, CGRectMake(0, -1, rect.size.width , 1));
    //下分割线
    CGContextSetStrokeColorWithColor(context,[UIColor colorWithRed:0.89 green:0.89 blue:0.90 alpha:1.00].CGColor);
    CGContextStrokeRect(context, CGRectMake(0, rect.size.height, rect.size.width, 1));
}
@end
